package cn.edu.hhtc.stsystem.struts2.login;

import java.util.ArrayList;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import cn.edu.hhtc.stsystem.security.domain.SysRoles;
import cn.edu.hhtc.stsystem.security.service.UserService;

import com.opensymphony.xwork2.ActionSupport;

/**
 * 登陆Action.
 * 
 * @author linyueqin
 * 
 */
@Results({ @Result(name = "login", location = "/WEB-INF/content/login.jsp") })
public class LoginAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6988221121827291328L;

	@Autowired
	private UserService userService;

	private List<SysRoles> roleList = new ArrayList<SysRoles>();

	@Action("/login")
	public String ShowLoginMain() throws Exception {

		roleList = this.userService.getAllRoles();

		return "login";
	}

	public List<SysRoles> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<SysRoles> roleList) {
		this.roleList = roleList;
	}

}
